package lab6.systemCustom;

import java.util.Observable;
import java.util.Observer;

abstract public class CommandEventHandler implements Observer {

	protected DataBase objDataBase;

	protected int iOutputEvCode;

	public CommandEventHandler(DataBase objDataBase, int iCommandEvCode, int iOutputEvCode) {
		EventBus.subscribeTo(iCommandEvCode, this);

		this.objDataBase = objDataBase;
		this.iOutputEvCode = iOutputEvCode;
	}

	public void update(Observable event, Object param) {
		EventBus.announce(this.iOutputEvCode, this.execute((String) param));
	}

	abstract protected String execute(String param);

}